<?php
/**

 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.

 * @license		GNU General Public License version 2 or later; see LICENSE.txt

 */
defined('_JEXEC') or die;
/**

 * Banners component helper.

 *

 * @package		Joomla.Administrator

 * @subpackage	com_regions

 * @since		1.6

 */

class RegionsHelper

{

	/**

	 * Configure the Linkbar.

	 *

	 * @param	string	The name of the active view.

	 *

	 * @return	void

	 * @since	1.6

	 */
	 
	 
	 public static function addSubmenu($vName)
	{
		JSubMenuHelper::addEntry(
			'Regions',
			'index.php?option=com_regions',
			$vName == 'regions'
		);

		JSubMenuHelper::addEntry(
			'Citys',
			'index.php?option=com_regions&view=citys',
			$vName == 'citys'
		);
		
		JSubMenuHelper::addEntry(
			'Districts',
			'index.php?option=com_regions&view=districts',
			$vName == 'districts'
		);
	}

	
	function quickIconButton( $link, $image, $text ) {
		
		$lang	= &JFactory::getLanguage();
		$button = '';
		if ($lang->isRTL()) {
			$button .= '<div class="icon-wrapper">';
		} else {
			$button .= '<div class="icon-wrapper">';
		}
		
		$button .=	'<div class="icon">'
				   .'<a href="'.$link.'">'
				   .JHTML::_('image', 'administrator/components/com_regions/assets/images/'.$image, $text )
				   .'<span>'.$text.'</span></a>'
				   .'</div>';
		$button .= '</div>';

		return $button;
	}

	public static function getActions()

	{

		$user	= JFactory::getUser();

		$result	= new JObject;

		$assetName = 'com_regions';

		$actions = array(

			'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'

		);



		foreach ($actions as $action) {

			$result->set($action,	$user->authorise($action, $assetName));

		}

		return $result;

	}
	public function getCountryOptions()
	{
		$db = & JFactory::getDBO();
		$db->setQuery("select id as value,title as text from #__regions where parent=0 order by text ASC");
		return $db->loadObjectList();
	}
}

